package org.dxy.ui;

import jakarta.annotation.PostConstruct;
import org.dxy.domain.game.adapter.event.DomainEvent;
import org.dxy.domain.game.adapter.event.EventQueue;
import org.dxy.domain.game.command.GameStartCommand;
import org.dxy.domain.game.database.GameDatabase;
import org.dxy.domain.game.model.aggregate.GameAggregate;
import org.dxy.domain.game.model.entity.PieceEntity;
import org.dxy.types.enums.PieceColorEnum;
import org.dxy.types.enums.PieceNameEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;


import java.util.List;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;

@SpringBootApplication
@ComponentScan(basePackages = {"org.dxy"}) // 扫描多个包
public class UiApplication implements CommandLineRunner {
    private final GameUI gameUI;
    // 构造器注入
    @Autowired
    public UiApplication(GameUI gameUI) {
        this.gameUI = gameUI;
    }


    public static void main(String[] args) {
        System.setProperty("java.awt.headless", "false");
        SpringApplication.run(UiApplication.class, args);
    }


    @Override
    public void run(String... args) throws Exception {
        gameUI.init();
    }

}
